| Conditions | 1 |
| Paths | 2 |
| Total Lines | 82 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | |||
| 11 | module.exports = function(publicPath, pro) {
|
||
| 12 | return {
|
||
| 13 | entry: {
|
||
| 14 | 'js/boot': path.join(__dirname, 'dev', 'boot.js'), |
||
| 15 | 'js/app': path.join(__dirname, 'dev', 'app.js'), |
||
| 16 | 'js/admin': path.join(__dirname, 'dev', 'admin.js') |
||
| 17 | }, |
||
| 18 | output: {
|
||
| 19 | pathinfo: true, |
||
| 20 | path: path.join(__dirname, 'rainloop', 'v', '0.0.0', 'static'), |
||
| 21 | filename: '[name].js', |
||
| 22 | publicPath: publicPath || 'rainloop/v/0.0.0/static/' |
||
| 23 | }, |
||
| 24 | plugins: [ |
||
| 25 | // new webpack.optimize.ModuleConcatenationPlugin(), |
||
| 26 | new webpack.DefinePlugin({
|
||
| 27 | 'RL_COMMUNITY': !pro, |
||
| 28 | 'process.env': {
|
||
| 29 | NODE_ENV: '"production"' |
||
| 30 | } |
||
| 31 | }), |
||
| 32 | new WebpackNotifierPlugin(), |
||
| 33 | new CopyWebpackPlugin([ |
||
| 34 | {from: 'node_modules/openpgp/dist/openpgp.min.js', to: 'js/min/openpgp.min.js'},
|
||
| 35 | {from: 'node_modules/openpgp/dist/openpgp.worker.min.js', to: 'js/min/openpgp.worker.min.js'}
|
||
| 36 | ]) |
||
| 37 | ], |
||
| 38 | resolve: {
|
||
| 39 | modules: [devPath, 'node_modules'], |
||
| 40 | extensions: ['.js'], |
||
| 41 | alias: {
|
||
| 42 | 'Opentip$': __dirname + '/dev/External/Opentip.js', |
||
| 43 | 'ko$': __dirname + '/dev/External/ko.js' |
||
| 44 | } |
||
| 45 | }, |
||
| 46 | module: {
|
||
| 47 | rules: [ |
||
| 48 | {
|
||
| 49 | test: /\.js$/, |
||
| 50 | loader: 'babel-loader', |
||
| 51 | include: [devPath], |
||
| 52 | options: {
|
||
| 53 | cacheDirectory: true, |
||
| 54 | presets: [['env', {
|
||
| 55 | loose: loose, |
||
| 56 | modules: false, |
||
| 57 | targets: {
|
||
| 58 | browsers: ['last 3 versions', 'ie >= 9', 'firefox esr'] |
||
| 59 | } |
||
| 60 | }], 'stage-0'], |
||
| 61 | plugins: ['transform-runtime', 'transform-decorators-legacy'] |
||
| 62 | } |
||
| 63 | }, |
||
| 64 | {
|
||
| 65 | test: /\.(html|css)$/, |
||
| 66 | loader: 'raw-loader', |
||
| 67 | include: [devPath] |
||
| 68 | }, |
||
| 69 | {
|
||
| 70 | test: /\.json$/, |
||
| 71 | loader: 'json-loader', |
||
| 72 | include: [devPath] |
||
| 73 | } |
||
| 74 | ] |
||
| 75 | }, |
||
| 76 | externals: {
|
||
| 77 | 'window': 'window', |
||
| 78 | 'progressJs': 'window.progressJs', |
||
| 79 | 'moment': 'window.moment', |
||
| 80 | 'ifvisible': 'window.ifvisible', |
||
| 81 | 'crossroads': 'window.crossroads', |
||
| 82 | 'hasher': 'window.hasher', |
||
| 83 | 'Jua': 'window.Jua', |
||
| 84 | 'Autolinker': 'window.Autolinker', |
||
| 85 | 'ssm': 'window.ssm', |
||
| 86 | 'key': 'window.key', |
||
| 87 | '_': 'window._', |
||
| 88 | 'qr': 'window.qr', |
||
| 89 | '$': 'window.jQuery' |
||
| 90 | } |
||
| 91 | }; |
||
| 92 | }; |
||
| 93 |